<?php $this->fetch('public/head') ?>
<div class="layui-tab layui-tab-brief">
    <ul class="layui-tab-title">
        <li class="layui-this">员工列表</li>
        <li onclick="update_sess()">更新缓存</li>
    </ul>
    <div class="layui-tab-content">
        <hr>
        <form action="" method="post" class="ajax-form">
            <div class="layui-tab-item layui-show">
                <table class="layui-table">
                    <thead>
                    <tr>
                        <th>微信ID</th>
                        <th>部门</th>
                        <th>姓名</th>
                        <th>手机号</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <?php foreach($lists as $v): ?>
                        <tr>
                            <td><?php echo $v['id'] ?></td>
                            <td><?php echo $v['depart_name'] ?></td>
                            <td><?php echo $v['name'] ?></td>
                            <td><?php echo $v['tel'] ?></td>
                            <td>
                                <a href="<?php echo url('edit?id='.$v['id']) ?>" class="layui-btn layui-btn-normal layui-btn-xs">编辑</a>
                            </td>
                        </tr>
                    <?php endforeach; ?>
                    </tbody>
                </table>
                <!--分页-->
<!--                --><?php //echo $list->render() ?>
            </div>
        </form>
    </div>
</div>

<?php $this->fetch('public/script') ?>
<script>
    function update_sess() {
        layer.msg('更新中...',{time:60000,icon: 16,shade: 0.3});
        $.ajax({
            url:"<?php echo url('companyuser/get_userlist')?>",
            success:function (data) {
                layer.closeAll();
                layer.msg(data.msg);
                setTimeout(function () {
                    location.reload();
                },1000)
            }
        })
    }
</script>

